Carbon


ThreadBeginCritical

Header: Threads.h Carbon status: Supported

Indicates that the thread is entering a critical code section.

OSErr ThreadBeginCritical ();
function result

A result code.

DISCUSSION

The ThreadBeginCritical function disables scheduling by marking the beginning of a section of critical code. That is, no other threads in the current application can runóeven if the current thread yields controlóuntil the current thread exits the critical section (by calling the ThreadEndCritical function). Disabling scheduling allows the currently executing function to look at or change shared or global data safely. You can nest critical sections within a thread.

To mark the end of a critical code section and turn scheduling back on, use the ThreadEndCritical function. If you also need to set the state of the current thread before scheduling is turned back on, use the SetThreadStateEndCritical function.

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when ThreadsLib 1.0 or later is installed. Exported by CarbonLib 1.0 and later and by ThreadsLib 1.0 and later.


© 2000 Apple Computer, Inc. — (Last Updated 3/8/2000)